{extend name="base/common"}

{block name="style"}
<link rel="stylesheet" href="/static/datepicker/bootstrap-datetimepicker.min.css">
<link rel="stylesheet" href="/static/iCheck/custom.css">
<link rel="stylesheet" href="/admin/css/chosen/chosen.css">
<style>
    .main{
        padding:12px;

    }
    .main>p{
        line-height: 2rem;
    }

    label{
        color: #333;
        display: inline;
        font-weight:normal;
    }
    input[type='radio']{
        width:13px;
        height:13px;
        outline: none;
        background: url("/home/images/application/radio2.png") center no-repeat;
        background-size: contain;
    }
    input[type='radio']:checked{
        background: url("/home/images/application/radio1.png") center no-repeat;
        background-size: contain;
    }
    input[type='text']{
        border-bottom:1px solid #000000;
    }

    .main>p{
        text-indent: 2rem;
    }
    .btn-group-sm>.btn, .btn-sm{

        font-size: 14px;

    }

</style>
{/block}

{block name="page-header"}
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-10">
        <h2><a href="{:Url('Carcard/index')}">充电柱申请列表</a></h2>
        <ol class="breadcrumb">
            <li>
                充电柱审核
            </li>
            <li class="active">
                <strong>详情</strong>
            </li>
        </ol>
    </div>
    <div class="col-lg-2">

    </div>
</div>
{/block}

{block name="main"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5></h5>
                    <div class="ibox-tools">
                        <a href="javascript:window.history.go(-1);" class="btn btn-white btn-sm"><i class="fa fa-reply"></i> 返回</a>
                    </div>
                </div>
                <div class="ibox-content all">



                    <form id="form" class="form-horizontal" method="post">
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>充电柱信息:</label>
                            </div>
                        </div>
                        <br>
                        <br>
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>充电柱号:</label>
                            </div>
                            <div class="col-lg-3">
                                <input type="text" placeholder="请输入充电柱" class="form-control form_title" name="electricity_id" value="{$info.electricity_id}">
                            </div>

                            <div class="col-lg-1 text-right control-label">
                                <label>车主姓名:</label>
                            </div>
                            <div class="col-lg-3">
                                <input type="text" readonly=ture class="form-control form_title" name="name" value="{$info.name}">
                            </div>
                            <div class="col-lg-1 text-right control-label">
                                <label>车主电话:</label>
                            </div>
                            <div class="col-lg-3">
                                <input type="text" readonly=ture class="form-control form_title" name="mobile"    value="{$info.mobile}">
                            </div>

                        </div>



                        <div class="form-group">


                            <div class="col-lg-1 text-right control-label">
                                <label>创建用户:</label>
                            </div>
                            <div class="col-lg-3">
                                <input  readonly=ture type="text" placeholder="请输入办理电话" class="form-control form_title"   value="{$info.user}">
                            </div>

                            <div class="col-lg-1 text-right control-label">
                                <label>创卡日期:</label>
                            </div>
                            <div class="col-lg-3">
                                <input  readonly=ture type="text" placeholder="请输入办理电话" class="form-control form_title"  value="{$info.create_time}">
                            </div>
                        </div>

                        <br>
                        <br>
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>订单详情:</label>
                            </div>
                        </div>
                        <br>
                        <br>

                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>类型:</label>
                            </div>
                            <div class="col-lg-2">
                                <input readonly=ture type="text" placeholder="请输入费用标准" class="form-control form_title" name="cost" value="{$info.type}">
                            </div>


                            <div class="col-lg-2 text-right control-label">
                                <label>办理期限:</label>
                            </div>
                            <div class="col-lg-2">
                                <input  readonly=ture type="text" placeholder="请输入办理期限" class="form-control form_title" name="term" value="{$info.aging}月">
                            </div>

                        </div>

                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>总金额:</label>
                            </div>
                            <div class="col-lg-2">
                                <input  readonly=ture type="text" placeholder="请输入办理期限" class="form-control form_title" name="term" value="{$info.money}元">
                            </div>

                            <div class="col-lg-2 text-right control-label">
                                <label>状态:</label>
                            </div>
                            <div class="col-lg-2">
                                <input  readonly=ture type="text" placeholder="请输入办理期限" class="form-control form_title" name="term" value="{$info.status_text}">
                            </div>

                        </div>
                        <br><br>
                        <div class="form-group">
                            <div class="col-lg-1 text-right control-label">
                                <label>缴费凭证:</label>
                            </div>
                            <br>
                            <div class="col-lg-5">
                                <div  class="imggroup">
                                    {volist name="$info.payment_voucher" id="vo"}
                                    <img src="{$vo}" style="max-width:500px;" class="img" alt="">
                                    {/volist}

                                </div>
                            </div>
                        </div>



                        {if condition="$info.status eq 0"}
                        <div class="form-group">
                            <div class="col-lg-11 col-lg-offset-1">
                                <button class="btn btn-primary submit-btn post-put" type="button" target-form="form-horizontal" >通过</button>

                                <a data-toggle="modal" class="btn btn-sm btn-primary" href="#modal-form" onclick="check()">不通过</a>
                            </div>
                        </div>
                        {else/}  <a data-toggle="modal" class="btn btn-sm btn-primary" href="#modal-form" onclick="change()">修改</a>
                        {/if}

                        <input type="hidden" name="id" value="{$info.id}">

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}

{block name="script"}
<script src="/static/uploadify/jquery.uploadify.min.js"></script>
<script src="/static/iCheck/icheck.min.js"></script>
<script src="/static/ueditor/ueditor.config.js"></script>
<script src="/static/ueditor/ueditor.all.min.js"></script>
<script src="/admin/js/chosen.jquery.js"></script>
<script>


    //通过
    $(".post-put").off('click').on("click",function(){
        var it=$(this);
        var data = {
            electricity_id:$("input[name='electricity_id']").val(),
            id:$("input[name='id']").val(),
            type:1
        };
        $.ajax({
            type:"post",
            url:$("#check").attr("action"),
            data:data,
            success:function(data){
                if(data.code == 1){
                    if (data.url) {
                        updateAlert(data.msg + ' 页面即将自动跳转~','success');
                    }else{
                        updateAlert(data.msg ,'success');
                    }
                    it.prop('disabled','true');
                    it.prev().prop('disabled','true');
                    setTimeout(function(){
                        if (data.url) {
                            location.href=data.url;
                        } else {
                            location.reload();
                        }
                        it.removeAttr('disabled');
                        it.prev().removeAttr('disabled')
                    },2000);
                } else {
                    updateAlert(data.msg, 'error');
                    it.attr('disabled','true');
                    it.prev().prop('disabled','true');
                    setTimeout(function(){
                        it.removeAttr('disabled');
                        it.prev().removeAttr('disabled')
                    },2000);
                }
            }
        });
        return false;
    });

    function check(){
        var data = {
            electricity_id:$("input[name='electricity_id']").val(),
            id:$("input[name='id']").val(),
            type:2
        };
        $.ajax({
            data: data,
            type: "POST",
            url: "{:Url('Electricity/check')}",
            success:function(data){
                updateAlert(data.msg,"success");
            }

        })

    }

    function change(){
        var data = {
            electricity_id:$("input[name='electricity_id']").val(),
            id:$("input[name='id']").val(),

        };
        $.ajax({
            data: data,
            type: "POST",
            url: "{:Url('Electricity/change')}",
            success:function(data){
                updateAlert(data.msg,"success");
            }

        })

    }
</script>
{/block}